<template>
  <view class="gdqss">
    <uni-list class="uni-list">
      <uni-list-item clickable :note="$t('开启后,国科量子解密功能才能正常使用')" :title="$t('是否启用')">
        <u-icon slot="header" name="gear" size="40"></u-icon>
        <u-switch slot="footer" v-model="gk.enable" @change="switchChage"></u-switch>
      </uni-list-item>
    </uni-list>
  </view>
</template>

<script>
import { mapGetters, mapActions } from 'vuex'

export default {
  data() {
    return {
      gk: {
        enable: getApp().globalData.GK_QSS_ONOFF.enable //是否启用
      }
    }
  },
  async onLoad() {
    uni.setNavigationBarTitle({title: this.$t('国科量子')})
  },
  methods: {
    switchChage(e) {
      uni.showToast({
        title: e ? this.$t('已开启量子功能') : this.$t('已关闭量子功能'),
        icon: 'none'
      })
      getApp().globalData.GK_QSS_ONOFF.enable = e
      uni.setStorageSync('gk_secretKey_enable', e)
    }
  }
}
</script>

<style lang="scss" scoped>
.gdqss {
}
</style>
